import React, { useState } from 'react';
import { Table } from 'antd';
import { useNavigate } from 'react-router-dom';
import order from '../../../store/YeGuoPing/order'
import {observer} from 'mobx-react'
import './index.scss'

export default observer(function OrderText() {
  const ver=useNavigate()
  const xiangqing=(a,b,c)=>{
    return ()=>{ 
      ver('/home/particulars',{state:b})
      localStorage.setItem('state',JSON.stringify(b))
    }
  }
  const columns = [
    {
      title: '订单号',
      dataIndex:'orderId',
      render: (text) => <span style={{color:'blue'}}>{text}</span>,
    },
    {
      title: '商品名称',
      dataIndex: 'goodsName',
    },
    {
      title: '订单类型',
      dataIndex: 'orderType',
      
    },
    {
      title: '手机号',
      dataIndex: 'memberPhone',
    },
    {
      title: '加盟商',
      dataIndex: 'franchisee',
    },
    {
      title: '交易状态',
      dataIndex: 'orderStatus',
    },
    {
      title: '订单金额',
      dataIndex: 'orderAmount',
    },
    {
      title: '下单时间',
      dataIndex: 'orderTime',
      sorter: {
        compare: (a, b) => a.下单时间 - b.下单时间,
        multiple: 2,
      },
    }
    ,
    {
      title: '操作',
      dataIndex: '查看',
      render: (a,b,c) => <span style={{color:'blue',cursor:'pointer'}} onClick={xiangqing(a,b,c)}>查看</span>,
    }
  ];
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);

  const onSelectChange = (newSelectedRowKeys) => {
    console.log(newSelectedRowKeys);
    setSelectedRowKeys(newSelectedRowKeys);
  };
  const rowSelection = {
    selectedRowKeys,
    onChange: onSelectChange,
  };
  return (
    <div id='textHeard'>
        <Table rowSelection={rowSelection} columns={columns} dataSource={order.count} pagination={{defaultPageSize:5}}/>
    </div>
  )
})
